package ru.averta.notes.web.ajax;

import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import ru.averta.notes.domain.Site;
import ru.averta.notes.domain.ajax.AjaxCommonListElement;
import ru.averta.notes.other.UtilsAjax;
import ru.averta.notes.service.SiteService;

/**
 *
 * @author fedor.belov
 */
 
@Controller
public class SubjectDisplayAjaxController {

    @Autowired
    private SiteService siteService;

    @RequestMapping(method = RequestMethod.GET, value = "/notes/refresh")
    public @ResponseBody Object getAllSites() {
        Collection<Site> notes = siteService.findByCUser();
        return UtilsAjax.castAjax(notes, AjaxCommonListElement.class);
    }

}
